#include "Project.h"

namespace xpm {

	Project::Project(Factory* factory): _factory(factory) {

	}

	KnowledgeBase* Project::knowledgeBase() {
		return &_kb;
	}

	void Project::setProjectFilePath(string filePath) {
		_projectFilePath = filePath;
	}

	string Project::projectFilePath() {
		return _projectFilePath;
	}

	void Project::save() {
		_factory->save(this);
	}

	string Project::getSources() {
		size_t last_slash_idx = _projectFilePath.find_last_of("\\");
		if(string::npos != last_slash_idx)
			return _projectFilePath.substr(0, last_slash_idx);
		return "";
	}
}